#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2018/11/28 14:36
@desc
"""
import time
import datetime

# 28-Nov-2018 07:24:26 GMT
# Wed, 28-Nov-2018 07:50:25 GMT;
# 字符类型的时间
tss1 = 'Wed, 28-Nov-2018 08:00:16 GMT;'
# 转为时间数组
timeArray = time.strptime(tss1, "%a, %d-%b-%Y %H:%M:%S %Z;")
print(timeArray)
# timeArray可以调用tm_year等
print(timeArray.tm_year)   # 2013
# 转为时间戳
timeStamp = int(time.mktime(timeArray))
print(timeStamp)  # 1381419600
# 1543363166
# 1543387828
# 结果如下
# time.struct_time(tm_year=2013, tm_mon=10, tm_mday=10, tm_hour=23, tm_min=40, tm_sec=0, tm_wday=3, tm_yday=283, tm_isdst=-1)

# print(time.time())
print(time.strftime("%Y-%m-%d %H:%M:%S"))
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))


print(time.time())
print(time.strftime("%Y%m%d"))

